import { getRecruit, getSubNav } from '@/api/kjsc'
let professionId = '21'
let config = {
  kjsc_cont: {
    module_name: '会计实操',
    path_name: 'kjsc',
    heads: {
      title: '会计实操_初级会计考试学习_之了课堂',
      keywords:
        '会计实操,会计记账课程,全盘账务处理与纳税申报,小规模全盘账务,零基础做账',
      description:
        '之了课堂-会计实操提供全盘账务处理与纳税申报、小规模全盘账务等课程，零基础手把手教做账。'
    },
    profession_id: 21,
    kjsc_menus: [
      {},
      {
        title: '财税政策',
        en: 'policy',
        nav_id: 11
      },
      {
        title: '热点干货',
        en: 'infos',
        nav_id: 10
      },
      {
        title: '会计实务',
        en: 'kjsw',
        nav_id: 18
      },
      {
        title: '就业指导',
        en: 'employment',
        nav_id: 19
      },
      {
        title: '实操问答',
        en: 'answer',
        nav_id: 20
      }
    ],
    banners: [
      {
        pic_url:
          '//image.zlketang.com/public/news/images/guanwangPic/kjsc_banner.jpg',
        path:
          'https://wap.zlketang.com/public/wxpub/page/zl_course/commodity.html?fromShop=1&product_id=2020003000349&course_id=349&source_page_subject=%E5%95%86%E5%9F%8E%E9%A6%96%E9%A1%B5&source_page_id='
      }
    ],
    hots: [
      {
        title: '2019初级会计新课开奖啦！',
        news_time: '11/21',
        path: ''
      },
      {
        title: '2019初级会计新课开奖啦！',
        news_time: '11/21',
        path: ''
      },
      {
        title: '2019初级会计新课开奖啦！',
        news_time: '11/21',
        path: ''
      },
      {
        title: '2019初级会计新课开奖啦！',
        news_time: '11/21',
        path: ''
      }
    ],
    stuffs: [
      {
        title: '重磅！2019年初级会计职称考试大纲已发布！',
        news_time: '11/21',
        path: ''
      },
      {
        title: '重磅！2019年初级会计职称考试大纲已发布！',
        news_time: '11/21',
        path: ''
      },
      {
        title: '重磅！2019年初级会计职称考试大纲已发布！',
        news_time: '11/21',
        path: ''
      },
      {
        title: '重磅！2019年初级会计职称考试大纲已发布！',
        news_time: '11/21',
        path: ''
      },
      {
        title: '重磅！2019年初级会计职称考试大纲已发布！',
        news_time: '11/21',
        path: ''
      },
      {
        title: '重磅！2019年初级会计职称考试大纲已发布！',
        news_time: '11/21',
        path: ''
      },
      {
        title: '重磅！2019年初级会计职称考试大纲已发布！',
        news_time: '11/21',
        path: ''
      },
      {
        title: '重磅！2019年初级会计职称考试大纲已发布！',
        news_time: '11/21',
        path: ''
      },
      {
        title: '重磅！2019年初级会计职称考试大纲已发布！',
        news_time: '11/21',
        path: ''
      },
      {
        title: '重磅！2019年初级会计职称考试大纲已发布！',
        news_time: '11/21',
        path: ''
      }
    ],
    pic_entry: [
      {
        pic_url:
          '//image.zlketang.com/public/news/images/guanwangPic/cjkj-quick.jpg',
        path: '/cjkjPlan'
      },
      {
        pic_url:
          '//image.zlketang.com/public/news/images/guanwangPic/course-entry.png',
        path: '/courses/?profession_id=' + professionId
      },
      {
        pic_url: '/news/images/global/tiku-entry.png',
        path: '/exercises/?profession_id=' + professionId
      }
    ],
    courses: [
      {
        course_name: '一般纳税人全盘账务处理+纳税申报',
        course_pic:
          '//image.zlketang.com/public/news/images/guanwangPic/kjsc-1.jpg',
        origin_price: '1188',
        now_price: '558',
        path: '/vplay/?course_id=148'
      },
      {
        course_name: '会计实操小规模纳税人全盘账务处理+税务申报',
        course_pic:
          '//image.zlketang.com/public/news/images/guanwangPic/kjsc-2.jpg',
        origin_price: '599',
        now_price: '188',
        path: '/vplay/?course_id=147'
      }
    ]
  }
}
let kjsc_cont = config.kjsc_cont
let module_name = kjsc_cont.module_name
export default {
  namespaced: true,
  state: {
    kjscCourseInfo: {}
  },
  mutations: {
    setInfo(state, data) {
      state.kjscCourseInfo = data
    }
  },
  actions: {
    async getInfo({ commit }, params) {
      let { path, query } = params.route
      let context = params.context
      let recruitData = {}

      try {
        recruitData = await getRecruit()
      } catch (e) {}
      let header_nav = recruitData.data && recruitData.data.sub_nav
      header_nav = Array.isArray(header_nav) ? header_nav : []
      let sub_nav = {}
      try {
        sub_nav = await getSubNav()
      } catch (e) {}
      let subNavList = sub_nav && sub_nav.data
      subNavList = Array.isArray(subNavList) ? subNavList : []
      let data = {
        module_name: module_name,
        path_name: kjsc_cont.path_name,
        professionPath: '',
        profession_id: professionId,
        header_nav,
        sub_nav: subNavList
      }
      commit('setInfo', data)
      return true
    }
  },
  getters: {}
}
